﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include "dynamicplot.h"
#include <QGridLayout>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    void freshChart();

    void dataGenerater_sin(double *buffer, int bufferLen, double stepLen);
    void dataGenerater_cos(double *buffer, int bufferLen, double stepLen);

private:
    int timerId;        //定时事件ID
    int bufferLen;      //缓冲区长度
    double *sinBuffer;  //sin缓冲区
    double *cosBuffer;  //cos缓冲区

    DynamicPlot *plot1; //曲线图实例1
    DynamicPlot *plot2; //曲线图实例2

    Ui::Widget *ui;

private slots:
    void timerEvent(QTimerEvent *event);
};
#endif // WIDGET_H
